/**
 * Generali Solutions d'assurances - Tous droits réservés &copy; 2007 - 2010
 */
package fr.generali.accueilclient.client.assembler.input;

import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

import fr.generali.accueilclient.client.om.IPersonne;
import fr.generali.refservcommuns.rce.desactivation.dtodesactivation.DtoDossierP18;
import fr.generali.refservcommuns.rce.desactivation.dtodesactivation.DtoListeDossierP18;
import fr.generali.refservcommuns.rce.desactivation.desactivationservice.Desactivation;

/**
 * @author selrhazala
 */
@Component("personneToDesactivationConverter")
public class PersonneToDesactivationConverter implements Converter<IPersonne, Desactivation> {

    /**
     * {@inheritDoc}
     */
    public Desactivation convert(IPersonne client) {
        Desactivation desactivation = null;

        if (client != null) {
            desactivation = new Desactivation();

            DtoListeDossierP18 listeDossierP18 = new DtoListeDossierP18();
            DtoDossierP18 dtoDossierP18 = new DtoDossierP18();
            dtoDossierP18.setCodeUser("BC");
            dtoDossierP18.getIdentifiantPersonne().add(client.getNumeroClient());
            listeDossierP18.getDossierP18().add(dtoDossierP18);
            desactivation.setDtoListeDossierP18(listeDossierP18);
        }

        return desactivation;
    }

}
